package se3a04.mcmapster;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class displayClueInfo extends Activity{
	
	Button solve, back;
	TextView name, riddle;
	clue tempClue = new clue();
		
	@Override
	protected void onCreate(Bundle displayClueInfoState) {

		super.onCreate(displayClueInfoState);
		setContentView(R.layout.clueinfo);
	
		solve = (Button) findViewById(R.id.bSolve);
		back = (Button) findViewById(R.id.bBack);
	
		name = (TextView) findViewById(R.id.tvClueName);
		riddle = (TextView) findViewById(R.id.tvRiddle);
		
		tempClue = currentHunt.clues.get(currentHunt.clueIndex);
	
		name.setText("Name: "+tempClue.clueName);
		riddle.setText("Riddle: "+tempClue.clueRiddle);
		
		solve.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				
				if(solveClue() == true) {
					
					finish();
				}
					
				else {
					//fail
					
				}
			}
		});
		
		back.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				
				finish();
			}
		});
	}
	
	public boolean solveClue() {
		
		String clueAnswer = null; 
		clueAnswer = tempClue.clueAnswer;
		String answerString = "3";
		//String answerString = QRcontroller.getCode();
		boolean isAnswerCorrect;
		
		if(clueAnswer == answerString) {
			isAnswerCorrect = true;
		}
		
		else {
			isAnswerCorrect = false;
		}
		
		return isAnswerCorrect;
	}
}
